<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head >
    <meta charset="UTF-8">
    <title>Index</title>
    <link rel="stylesheet" th:href="@{/css/index.css}">
    <script th:src="@{/js/jquery-3.4.1.min.js}"></script>
    <script>
        // $(function(){
        //     alert();
        // });
    </script>
</head>
<body>


    <h1>this is thymeleaf html aabba</h1>

    <h1>展示单个数据</h1>

        欢迎: <span th:text="${name}"/>  username: <span th:utext="${username}"></span>
             <input type="text" th:value="${name}">
    <input type="text" th:value="${name}">

    <h1>展示对象数据</h1>

        <ul>
            <li>id:<span th:text="${user.id}"/></li>
            <li>name:<span th:text="${user.name}"/></li>
            <li>age:<span th:text="${user.age}"/></li>
            <li>bir:<span th:text="${#dates.format(user.bir,'yyyy-MM-dd')}"/></li>
        </ul>

    <h1>有条件展示数据</h1>


        <span th:if="${user.age} le 23" th:text="${user.name}"></span>



    <h1>展示多个数据(获取遍历状态)</h1>

    <ul th:each="user,userStat:${users}">
        <li>当前遍历的次数: <span th:text="${userStat.count}"/> 当前遍历的索引: <span th:text="${userStat.index}"/> 当前遍历是否是奇数行: <span th:text="${userStat.odd}"/> 当前遍历是否是偶数行: <span th:text="${userStat.even}"/> </li>
        <li><span th:text="${user.id}"/></li>
        <li><span th:text="${user.name}"/></li>
        <li><span th:text="${user.age}"/></li>
        <li><span th:text="${#dates.format(user.bir,'yyyy年MM月dd日')}"/></li>
        <li>集合中总记录数:<span th:text="${userStat.size}"/></li>
    </ul>


    <h1>测试连接中路径</h1>
    <a th:href="@{/user/delete(id=21,name='xiaohei')}">删除记录</a>

</body>
</html>